package entity

import (
	"encoding/json"
	"github.com/lib/pq"
)

type UpgradeStrategy struct {
	Id                  int64           `gorm:"column:id;primary_key" json:"id"`
	FirmwareIds         pq.Int64Array   `gorm:"column:firmware_ids;type:bigint[];not null" json:"firmware_ids"`
	Name                string          `gorm:"column:name;type:varchar(255);not null" json:"name"`
	UpgradeType         int             `gorm:"column:upgrade_type;type:integer;not null" json:"upgrade_type"`
	Order               json.RawMessage `json:"order"`
	FailureNotifyMethod int             `gorm:"column:failure_notify_method;type:integer;not null" json:"failure_notify_method"`
	RetryCount          int             `gorm:"column:retry_count;type:integer;not null" json:"retry_count"`
	CreatedAt           int64           `gorm:"column:created_at;type:bigint;not null" json:"created_at"`
	UpdatedAt           int64           `gorm:"column:updated_at;type:bigint;not null" json:"updated_at"`
}

func (u *UpgradeStrategy) TableName() string {
	return "upgrade_strategy"
}
